﻿using System;
using System.Collections;
using System.Collections.Generic;

using NetStsAdm.Commands;

namespace NetStsAdm
{
    internal class BuiltInCommands
    {
        Dictionary<string, Type> commands;

        internal BuiltInCommands()
        {
            commands = new Dictionary<string, Type>();
            provision();
        }

        void provision()
        {
            commands.Add("h", typeof(HelpCommand));
            commands.Add("config", typeof(ConfigCommand));
            commands.Add("o", typeof(StsAdmCommand));
            commands.Add("help", typeof(StsAdmCommand));
        }

        internal Type GetCommandType(ICollection input)
        {
            foreach (string s in input)
            {
                string k = s.Substring(1);
                if (commands.ContainsKey(k))
                    return commands[k];
            }
            return null;
        }
    }
}
